using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Security.Cryptography;
using System.Text;

/// <summary>
/// Summary description for Encryptor
/// </summary>
public class Encryptor
{
    public Encryptor() { }

    public byte[] SHA1Encrypt(string inputString)
    {
        SHA1 sha1 = SHA1Managed.Create();
        byte[] input = Encoding.Default.GetBytes(inputString);
        byte[] output = sha1.ComputeHash(input);
        return output;
    }

    public string MD5Encrypt(string inputString)
    {
        MD5 md5 = MD5CryptoServiceProvider.Create();
        byte[] input = Encoding.Default.GetBytes(inputString);
        byte[] output = md5.ComputeHash(input);
        string outputString = BitConverter.ToString(output).Replace("-", "");

        //StringBuilder s = new StringBuilder();
        //foreach (byte b in output)
        //{
        //    s.Append(b.ToString("x2").ToUpper());
        //}
        //string outputString = s.ToString();

        return outputString;
    }
}
